3.793 \(\int \frac {3+\cos (c+d x)}{2-\cos (c+d x)} \, dx\)

Optimal. Leaf size=47 \[ \frac {10 \tan ^{-1}\left (\frac {\sin (c+d x)}{-\cos (c+d x)+\sqrt {3}+2}\right )}{\sqrt {3} d}+\frac {5 x}{\sqrt {3}}-x \]

[Out]

-x+5/3*x*3^(1/2)+10/3*arctan(sin(d*x+c)/(2-cos(d*x+c)+3^(1/2)))/d*3^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.07, antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {2735, 2657} \[ \frac {10 \tan ^{-1}\left (\frac {\sin (c+d x)}{-\cos (c+d x)+\sqrt {3}+2}\right )}{\sqrt {3} d}+\frac {5 x}{\sqrt {3}}-x \]

Antiderivative was successfully verified.

[In]

Int[(3 + Cos[c + d*x])/(2 - Cos[c + d*x]),x]

[Out]

-x + (5*x)/Sqrt[3] + (10*ArcTan[Sin[c + d*x]/(2 + Sqrt[3] - Cos[c + d*x])])/(Sqrt[3]*d)

Rule 2657

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{q = Rt[a^2 - b^2, 2]}, Simp[x/q, x] + Simp
[(2*ArcTan[(b*Cos[c + d*x])/(a + q + b*Sin[c + d*x])])/(d*q), x]] /; FreeQ[{a, b, c, d}, x] && GtQ[a^2 - b^2,
0] && PosQ[a]

Rule 2735

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*x)/d
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rubi steps

\begin {align*} \int \frac {3+\cos (c+d x)}{2-\cos (c+d x)} \, dx &=-x+5 \int \frac {1}{2-\cos (c+d x)} \, dx\\ &=-x+\frac {5 x}{\sqrt {3}}+\frac {10 \tan ^{-1}\left (\frac {\sin (c+d x)}{2+\sqrt {3}-\cos (c+d x)}\right )}{\sqrt {3} d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.06, size = 31, normalized size = 0.66 \[ \frac {10 \tan ^{-1}\left (\sqrt {3} \tan \left (\frac {1}{2} (c+d x)\right )\right )}{\sqrt {3} d}-x \]

Antiderivative was successfully verified.

[In]

Integrate[(3 + Cos[c + d*x])/(2 - Cos[c + d*x]),x]

[Out]

-x + (10*ArcTan[Sqrt[3]*Tan[(c + d*x)/2]])/(Sqrt[3]*d)

________________________________________________________________________________________

fricas [A]  time = 1.88, size = 43, normalized size = 0.91 \[ -\frac {3 \, d x + 5 \, \sqrt {3} \arctan \left (\frac {2 \, \sqrt {3} \cos \left (d x + c\right ) - \sqrt {3}}{3 \, \sin \left (d x + c\right )}\right )}{3 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((3+cos(d*x+c))/(2-cos(d*x+c)),x, algorithm="fricas")

[Out]

-1/3*(3*d*x + 5*sqrt(3)*arctan(1/3*(2*sqrt(3)*cos(d*x + c) - sqrt(3))/sin(d*x + c)))/d

________________________________________________________________________________________

giac [A]  time = 0.33, size = 72, normalized size = 1.53 \[ -\frac {3 \, d x - 5 \, \sqrt {3} {\left (d x + c + 2 \, \arctan \left (-\frac {\sqrt {3} \sin \left (d x + c\right ) - 3 \, \sin \left (d x + c\right )}{\sqrt {3} \cos \left (d x + c\right ) + \sqrt {3} - 3 \, \cos \left (d x + c\right ) + 3}\right )\right )} + 3 \, c}{3 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((3+cos(d*x+c))/(2-cos(d*x+c)),x, algorithm="giac")

[Out]

-1/3*(3*d*x - 5*sqrt(3)*(d*x + c + 2*arctan(-(sqrt(3)*sin(d*x + c) - 3*sin(d*x + c))/(sqrt(3)*cos(d*x + c) + s
qrt(3) - 3*cos(d*x + c) + 3))) + 3*c)/d

________________________________________________________________________________________

maple [A]  time = 0.10, size = 39, normalized size = 0.83 \[ \frac {10 \sqrt {3}\, \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {3}\right )}{3 d}-\frac {2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((3+cos(d*x+c))/(2-cos(d*x+c)),x)

[Out]

10/3/d*3^(1/2)*arctan(tan(1/2*d*x+1/2*c)*3^(1/2))-2/d*arctan(tan(1/2*d*x+1/2*c))

________________________________________________________________________________________

maxima [A]  time = 0.43, size = 52, normalized size = 1.11 \[ \frac {2 \, {\left (5 \, \sqrt {3} \arctan \left (\frac {\sqrt {3} \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right ) - 3 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )\right )}}{3 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((3+cos(d*x+c))/(2-cos(d*x+c)),x, algorithm="maxima")

[Out]

2/3*(5*sqrt(3)*arctan(sqrt(3)*sin(d*x + c)/(cos(d*x + c) + 1)) - 3*arctan(sin(d*x + c)/(cos(d*x + c) + 1)))/d

________________________________________________________________________________________

mupad [B]  time = 0.67, size = 74, normalized size = 1.57 \[ \frac {\left (\frac {\pi -\frac {5\,\pi \,\sqrt {3}}{3}}{d}-\frac {\pi +\frac {5\,\pi \,\sqrt {3}}{3}}{d}\right )\,\left (\mathrm {atan}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )-\frac {d\,x}{2}\right )}{\pi }-\frac {d\,x-\frac {10\,\sqrt {3}\,\mathrm {atan}\left (\sqrt {3}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{3}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-(cos(c + d*x) + 3)/(cos(c + d*x) - 2),x)

[Out]

(((pi - (5*3^(1/2)*pi)/3)/d - (pi + (5*3^(1/2)*pi)/3)/d)*(atan(tan(c/2 + (d*x)/2)) - (d*x)/2))/pi - (d*x - (10
*3^(1/2)*atan(3^(1/2)*tan(c/2 + (d*x)/2)))/3)/d

________________________________________________________________________________________

sympy [A]  time = 2.42, size = 56, normalized size = 1.19 \[ \begin {cases} - x + \frac {10 \sqrt {3} \left (\operatorname {atan}{\left (\sqrt {3} \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )} \right )} + \pi \left \lfloor {\frac {\frac {c}{2} + \frac {d x}{2} - \frac {\pi }{2}}{\pi }}\right \rfloor \right )}{3 d} & \text {for}\: d \neq 0 \\\frac {x \left (\cos {\relax (c )} + 3\right )}{2 - \cos {\relax (c )}} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((3+cos(d*x+c))/(2-cos(d*x+c)),x)

[Out]

Piecewise((-x + 10*sqrt(3)*(atan(sqrt(3)*tan(c/2 + d*x/2)) + pi*floor((c/2 + d*x/2 - pi/2)/pi))/(3*d), Ne(d, 0
)), (x*(cos(c) + 3)/(2 - cos(c)), True))

________________________________________________________________________________________